<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"yoursite.com","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="计算机网络基础、 CCNA IPV4:32位 IPV6:128位 通信时,进程的数字标识 16bit 0-65535:1-65535 1-1023：固定分配，只有管理员有权限启用； 1024-4W：半固定 4W+: 临时 进程地址： IP：port，socket MAC：本地通信，范围，本地局域网 IP：界定通信主机，源和目标主机；范围：互联网； port：界定进程，范围：主机 ​">
<meta property="og:type" content="article">
<meta property="og:title" content="13.网络基础">
<meta property="og:url" content="http://yoursite.com/2020/06/15/13-%E7%BD%91%E7%BB%9C%E5%9F%BA%E7%A1%80/index.html">
<meta property="og:site_name" content="Lcxiao&#39;s blog">
<meta property="og:description" content="计算机网络基础、 CCNA IPV4:32位 IPV6:128位 通信时,进程的数字标识 16bit 0-65535:1-65535 1-1023：固定分配，只有管理员有权限启用； 1024-4W：半固定 4W+: 临时 进程地址： IP：port，socket MAC：本地通信，范围，本地局域网 IP：界定通信主机，源和目标主机；范围：互联网； port：界定进程，范围：主机 ​">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-06-15T05:07:53.000Z">
<meta property="article:modified_time" content="2020-06-15T13:08:21.064Z">
<meta property="article:author" content="lcxiao">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="http://yoursite.com/2020/06/15/13-%E7%BD%91%E7%BB%9C%E5%9F%BA%E7%A1%80/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>13.网络基础 | Lcxiao's blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="Lcxiao's blog" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Lcxiao's blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-fw fa-user"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
        <li class="menu-item menu-item-lifestyle">

    <a href="/lifestyle/" rel="section"><i class="fa fa-fw fa-lifestyle"></i>LifeStyle</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2020/06/15/13-%E7%BD%91%E7%BB%9C%E5%9F%BA%E7%A1%80/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="lcxiao">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Lcxiao's blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          13.网络基础
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2020-06-15 13:07:53 / 修改时间：21:08:21" itemprop="dateCreated datePublished" datetime="2020-06-15T13:07:53+08:00">2020-06-15</time>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>计算机网络基础、</p>
<p>CCNA</p>
<p>IPV4:32位</p>
<p>IPV6:128位</p>
<p>通信时,进程的数字标识</p>
<p>16bit</p>
<p>0-65535:1-65535</p>
<p>1-1023：固定分配，只有管理员有权限启用；</p>
<p>1024-4W：半固定</p>
<p>4W+: 临时</p>
<p>进程地址：</p>
<p>IP：port，socket</p>
<p>MAC：本地通信，范围，本地局域网</p>
<p>IP：界定通信主机，源和目标主机；范围：互联网；</p>
<p>port：界定进程，范围：主机</p>
<p>​                    OSI                                    TCP（事实标准）</p>
<p>资源子网：应用层                                应用层</p>
<p>​                    表示层</p>
<p>​                    会话层</p>
<p>通信子网：传输层                            传输层</p>
<p>​                    网络层                            网络层</p>
<p>​                    数据链路层                    物理层</p>
<p>​                    物理层                            </p>
<p>OS：</p>
<p>用户空间：应用提供资源</p>
<p>内核空间：进程调度，内存分配，网络功能（TCP协议栈）</p>
<p>端口由内核分配</p>
<p>路由表：</p>
<ul>
<li>静态学习</li>
<li>动态学习：rlp2，ospf</li>
</ul>
<p>路由条目：</p>
<ul>
<li>目标地址 下一跳（nexthop）</li>
<li>主机路由</li>
<li>网络路由</li>
<li>默认路由</li>
</ul>
<p>优先选择匹配范围最小的</p>
<p>将一台Linux主机接入到网络中实现网络通信：</p>
<ul>
<li>IP/MASK：本地通信；</li>
<li>路由：跨网络通信；</li>
<li>DNS服务器地址：基于主机名的通信；<ul>
<li>主dns服务器</li>
<li>次dns服务器</li>
<li>第三备用dns服务器</li>
</ul>
</li>
<li>配置方式<ul>
<li>动态分配DHCP</li>
<li>静态分配</li>
<li>ifcfg家族<ul>
<li>ifconfig：配置ip，netmask</li>
<li>route：路由</li>
<li>netstat：状态及统计数据查看</li>
</ul>
</li>
<li>iproute2家族：–&gt;in OBJECT：<ul>
<li>addr：地址和掩码</li>
<li>link：接口</li>
<li>route：路由</li>
<li>ss：状态及统计数据查看</li>
</ul>
</li>
<li>Centos7：NM（NetworkManager）家族<ul>
<li>nmcli：命令行工具</li>
<li>nmtui：text window工具</li>
</ul>
</li>
<li>注意：<ul>
<li>DNS服务器的指定–&gt;配置文件：/etc/resolv.conf</li>
<li>主机名：<ul>
<li>hostname</li>
<li>配置文件：/etc/sysconfig/network</li>
<li>Centos7：hostnamectl</li>
</ul>
</li>
</ul>
</li>
<li>配置文件：<ul>
<li>Redhat及相关发行版<ul>
<li>/etc/sysconfig/network-scripts/ifcfg-NETCARD_NAME</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>网卡接口命名方式：</p>
<ul>
<li><p>传统命名：</p>
<ul>
<li>以太网：ethx,[0,oo],例如eth0,rth1…</li>
<li>PPP网络：pppx[0,…]，例如：ppp0,ppp1，…</li>
</ul>
</li>
<li><p>可预测命名方案（Centos）：</p>
<ul>
<li>支持多种不同的命名机制：</li>
<li>Firmwar，拓扑结构</li>
</ul>
<ol>
<li>如果Firmware或BIOS为主板上集成的设备提供的索引信息可用，则根据此索引进行命名，如eno1，eno2，…</li>
<li>如果Firmware或BIOS为PCI-E扩展槽所提供的索引信息可用，且可预测，则根据此索引进行命名，如ens1，ens2，…</li>
<li>如果硬件接口的物理位置信息可用，则根据此信息命名，如enp2s0，…</li>
<li>如果用户显示定义，也可根据MAC地址命名，例如enx122161ab2e10，…</li>
<li>上述均不可用时，则仍使用传统方式命名；</li>
</ol>
<p>命名格式的组成：</p>
<p>​    en：ethernet</p>
<p>​    wl：wlan</p>
<p>​    ww：wwan</p>
<p>​    名称类型：</p>
<p>​        o&lt;index&gt;：集成设备的设备索引号；</p>
<p>​        s&lt;slot&gt;：扩展槽的索引号；</p>
<p>​        x&lt;MAC&gt;：基于MAC地址的命名；</p>
<p>​        p&lt;bus&gt;s&lt;slot&gt;：基于总线及槽的拓扑结构命名；</p>
</li>
</ul>
<p>PDU –&gt;  数据报文 –&gt; 数据帧</p>
<p>协议传输单元</p>
<p>链路层：以太网帧</p>
<p>互联网层：IP报文</p>
<p>以太网帧：MTU（1500）</p>
<p>linux配置命令：</p>
<p>ifcfg命令家族：ifconfig,route,netstat</p>
<p>ifconfig:</p>
<p>UP：激活</p>
<p>MTU：最大传输单元 (Maximum transmission unit)</p>
<p>MULTICAST:多播（组播）</p>
<p>BROADCAST：广播</p>
<p>prefixlen：前缀</p>
<p>txqueuelen：</p>
<p>RX：接收 ：主要关注dropped,overruns这两项；</p>
<p>TX：发送</p>
<p>ether：centos7表示以太网，相当于centos6 HWaddr：MAC地址；</p>
<p>txqueuelen：传输队列长度</p>
<p>EXP:</p>
<p><code>ifconfig eth1 192.168.10.100/24 up</code></p>
<p><code>ifconfig eth1 192.168.10.100 netmask 255.255.255.0</code></p>
<p>送往内核中的tcp/ip协议栈，立即生效；</p>
<p>启用混杂模式：</p>
<p><code>ifconfig eth1 promisc</code></p>
<p><code>ifconfig eth1 -promisc</code></p>
<p>管理IPV6：</p>
<p><code>add addr/prefixlen</code></p>
<p><code>del addr/prefixlen</code></p>
<p>ROUTE命令：</p>
<p>路由类型：</p>
<p>主机路由    目标为单个IP</p>
<p>网络路由    目标为网络主机</p>
<p>默认路由：目标为任意主机</p>
<p>route -n：查看显示路由条目，-n指以数字格式显示，不反解路由条目；</p>
<p>Kernel IP routing table</p>
<p>Destination     Gateway        Genmask    Flags    Metric    Ref    Use    Iface</p>
<p><code>route add -net 10.0.0.0/8 gw 192.168.10.1 dev eth1</code></p>
<p><code>route add -net 0.0.0.0/0.0.0.0 gw 192.168.10.1 dev eth1</code></p>
<p><code>route add default gw 192.168.10.1</code></p>
<p><code>route del -net 10.0.0.0/8 gw 192.168.10.0</code></p>
<p><code>route del default</code></p>
<p>Netstat 命令</p>
<p>显示路由表：netstat -rn</p>
<p>​    -r：显示内核路由表</p>
<p>​    -n：数字格式</p>
<p>显示网络连接：</p>
<p>​    netstat [–tcp|-t] [–udp|-u]</p>
<p>​    -t：tcp相关的连接</p>
<p>​    -u：UDP</p>
<p>​    -w：raw    </p>
<p>​    -l：处于监听的连接</p>
<p>​    -a：所有状态</p>
<p>​    -n：数字格式显示ip和port</p>
<p>​    -e：扩展格式</p>
<p>​    -p：显示进程及PID</p>
<p>常用组合：ntlp。pantu。nta，utp</p>
<p>​    传输层协议：</p>
<p>​    tcp：面向连接的协议。要建立连接，通信完成拆除连接；</p>
<p>​    udp：无连接的协议；直接发送报文；</p>
<p>所有接口</p>
<p>​    netstat -i</p>
<p>指定接口</p>
<p>​    netsrtat -I &lt;IFACE&gt;</p>
<p>ifup/ifdown 命令</p>
<p>通过配置文件来识别接口并完成配置</p>
<p>/etc/sysconfig/network-scripts/ifcfg-IFACE</p>
<p>hostname命令</p>
<p>查看：hostname</p>
<p>配置：hostname HOSTNAME     重启失效</p>
<p>Centos7：hostnamectl</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line">root@testlab:~<span class="comment"># hostnamectl --help</span></span><br><span class="line">hostnamectl [OPTIONS...] COMMAND ...</span><br><span class="line"></span><br><span class="line">Query or change system hostname.</span><br><span class="line"></span><br><span class="line">  -h --<span class="built_in">help</span>              Show this <span class="built_in">help</span></span><br><span class="line">     --version           Show package version</span><br><span class="line">     --no-ask-password   Do not prompt <span class="keyword">for</span> password</span><br><span class="line">  -H --host=[USER@]HOST  Operate on remote host</span><br><span class="line">  -M --machine=CONTAINER Operate on <span class="built_in">local</span> container</span><br><span class="line">     --transient         Only <span class="built_in">set</span> transient hostname</span><br><span class="line">     --static            Only <span class="built_in">set</span> static hostname</span><br><span class="line">     --pretty            Only <span class="built_in">set</span> pretty hostname</span><br><span class="line"></span><br><span class="line">Commands:</span><br><span class="line">  status                 Show current hostname settings	<span class="comment">#显示当前主机名信息；</span></span><br><span class="line">  <span class="built_in">set</span>-hostname NAME      Set system hostname	<span class="comment">#设定主机名，永久有效；</span></span><br><span class="line">  <span class="built_in">set</span>-icon-name NAME     Set icon name <span class="keyword">for</span> host</span><br><span class="line">  <span class="built_in">set</span>-chassis NAME       Set chassis <span class="built_in">type</span> <span class="keyword">for</span> host</span><br><span class="line">  <span class="built_in">set</span>-deployment NAME    Set deployment environment <span class="keyword">for</span> host</span><br></pre></td></tr></table></figure>

<p>配置文件：/etc/sysconfig/network</p>
<p>HOSTNAME=&lt;HOSTNAME&gt;</p>
<p>此方法不会立即生效，但是会一直有效</p>
<p>配置DNS服务器指向:</p>
<p>配置件：/etxc/resolv.conf</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[root@Centos7 ~]<span class="comment"># cat /etc/resolv.conf</span></span><br><span class="line"><span class="comment"># Generated by NetworkManager</span></span><br><span class="line">search localdomain</span><br><span class="line">nameserver 192.168.1.2	<span class="comment">#注意写IP，不能写域名</span></span><br></pre></td></tr></table></figure>

<p>测试DNS（dig、host、nslookup）</p>
<p>dig -t A FQDN</p>
<p>​    FQDN–IP</p>
<p>互联网大多数主机名不支持反解，就是从IP解析到域名</p>
<p>dig -x IP</p>
<p>IP–FQDN</p>
<p><strong>iproute2家族:</strong></p>
<p>IP命令:查看，管理，路由，设备，策略路由，隧道</p>
<p> ip [ OPTIONS ] OBJECT { COMMAND | help }</p>
<p>OBJECT ：命令可简写，只要能唯一识别</p>
<p>link | address | route</p>
<p>ip link：网络设备的配置（add、show、set、delete）</p>
<ul>
<li>ip link set  :改便设备运行状态<ul>
<li>ip link set dev IFACE up/down</li>
<li>multicast on/off 开启/关闭多播功能；</li>
<li>promisc on/off：启用/关闭混杂模式</li>
<li>name:改网卡名（改之前先停用网卡）</li>
<li>txqueuelen：队列长度</li>
<li>mtu：设置MTU大小，默认1500</li>
<li>netns：net namespace，用于将接口移动到指定的网络名称空间去（类似虚拟机）<ul>
<li>ip netns add </li>
<li>ip netns list</li>
<li>ip netns del</li>
<li>ip netns exec NAME COMMAAND</li>
</ul>
</li>
</ul>
</li>
<li>ip link show</li>
<li>ip link help</li>
</ul>
<p><strong>ip address add</strong></p>
<p>​    ip address add IFADDR dev IFNAME</p>
<p>​    label NAME ：为额外添加的IP地址指明接口别名；</p>
<p>​    [broadcast ADDRESS]：广播地址；会根据IP和NETMASK自动计算得到；</p>
<p>​    [scope SCOPE_VALUE]：global（全局可用）、site（IPV6）、link（接口可用）、host（仅本机可用、内部使用）</p>
<p><strong>ip address del</strong></p>
<p>​    ip address delIFADDR dev IFNAME</p>
<p> <strong>ip address show</strong></p>
<p>​    [iFACE] ：仅显示指定接口；</p>
<p>ip address flush dev</p>
<p><strong>ip route add|delete|show |flush|get</strong></p>
<p>​    ip route add TYPE PREFIX via GW [dev IFACE] [src SOURCE_IP]</p>
<p>exp:</p>
<p><code>ip route add 192.168.0.0/24 via 10.0.0.1 dev eth1</code></p>
<p><code>ip route add 192.168.1.0/24 via 192.168.1.128 dev eth1 src 192.168.1.128</code> （src为本机网卡地址中的其中一个）</p>
<p>​    ip route add default via GW；</p>
<p><code>ip route add default via 192.168.1.2</code></p>
<p><strong>ip route del</strong></p>
<p>#ip route delete 192.168.1.0/24</p>
<p><strong>ip route get TYPE PREFIX</strong></p>
<p>#ip route get 192.168.0.0/24</p>
<p>SS 命令：</p>
<ul>
<li>-t ：tcp</li>
<li>-u：udp</li>
<li>-w：raw</li>
<li>-l：listen</li>
<li>-a：所有状态</li>
<li>-n：数字格式</li>
<li>-p：PID和进程</li>
<li>-e：扩展</li>
<li>-m：内存用量</li>
<li>-o：计时器信息</li>
</ul>
<p>FILTER := [ state STATE-FILTER ] [ EXPRESSION ]：过滤选项</p>
<p>TCP的常见状态：</p>
<p>TCP FSM：</p>
<p>​    LISTEN：监听</p>
<p>​    ESTABLISEHD：建立的连接</p>
<p>​    FIN_WAIT_1：</p>
<p>​    FIN_WAIT_2:</p>
<p>​    SYN_SENT:</p>
<p>​    SYN_RECV:</p>
<p>​    CLOSED:</p>
<p>EXPRESSION:</p>
<p>​    dport=</p>
<p>​    sport=</p>
<p>​        示例：ss -tan state 状态</p>
<p>配置文件：/etx/sysconfig/network-scripts/ifcfg-IFACE</p>
<p>IP/NETMASK/GW/DNS等专属的配置文件：</p>
<p>IFACE：接口名称</p>
<p>路由的相关配置文件：</p>
<p>/etc/sysconfig/network-scripts/route-IFACE</p>
<p>配置文件/etc/sysconfig/network-scripts/ifcfg-IFACE通过大量参数来定义接口的属性；其可通过vim等文本编辑器直接修改，也可以使用专用的命令的进行修改</p>
<p>centos6：system-config-network</p>
<p>centos7：nmtui，nmcli</p>
<p>ifcfg-IFACE配置文件参数：</p>
<ul>
<li>DEVICE：设备名称，与IFACE必须保持一致；</li>
<li>ONBOOT：在系统引导过程中是否激活设备；</li>
<li>NETBOOT：是否支持网络引导；</li>
<li>UUID：此设备的唯一标识；</li>
<li>IPV6INIT：是否初始化IPV6；</li>
<li>BOOTPROTO=激活此接口时使用什么协议配置接口属性，常用的有dhcp，bootp，static=none；</li>
<li>TYPE：指定接口类型；</li>
<li>DNS1~~DNS2：DNS服务器指向；</li>
<li>DOMAIN：DNS搜索域；</li>
<li>DEFROUTE：是否默认路由所使用接口；</li>
<li>GATEWAY：默认网关；</li>
<li>IPADDR：IP地址；</li>
<li>NETMASK：子网掩码；Centos7支持使用prefix以长度方式指明子网掩码；</li>
<li>IPV4_FAILURE_FATAL ：</li>
<li>USERCTL：是否允许普通用户控制此设备；</li>
<li>PEERDNS：如果bootproto的值为’dhcp‘，是否允许dhcpserver分配的dns服务器指向覆盖本地手动指定的dns服务器；默认为允许；</li>
<li>NM_CONTROLLED：是否使用NetworkManager服务来控制接口配置；</li>
</ul>
<p>网络服务：</p>
<p>​    network</p>
<p>​    NetworkManager</p>
<p>管理网络服务</p>
<p>​    centos6：service SERVICE {start|status|restart|stop}</p>
<p>​    centos7：systemctl {status|start|stop|restart} SERVICE</p>
<p>配置修改以后，如果要生效，需要重启网络服务</p>
<p>centos6：service network restart</p>
<p>centos7：systemctl restart network.service</p>
<p>用到非默认网关路由：/etc/sysconfig/network-scripts/route-IFACE</p>
<p>支持两种配置方式，但是不可混用；</p>
<ol>
<li><p>每行一个路由条目</p>
<p>​    TARGET via GW</p>
<ol start="2">
<li>每三行一个路由条目：</li>
</ol>
<p>ADDRESS#=TARGET</p>
<p>NETMASK#=MASK</p>
<p>GATEWAY#=NEXTHOP</p>
</li>
</ol>
<p>ifconfig 也可以添加多个IP地址</p>
<p>1.ifconfig IFACE——LABEL IPADDR/NETMASK</p>
<p>​    IFACE_LABEL：eth0，eth1</p>
<p>为别名添加配置文件：</p>
<p>DEVICE=IFACE_LABEL</p>
<p>BOOTPROTO：网上别名不支持动态获取</p>
<p>static，none；</p>
<p>NMCLI：</p>

    </div>

    
    
    
        

  <div class="followme">
    <p>欢迎关注我的其它发布渠道</p>

    <div class="social-list">

        <div class="social-item">
          <a target="_blank" class="social-link" href="/atom.xml">
            <span class="icon">
              <i class="fa fa-rss"></i>
            </span>

            <span class="label">RSS</span>
          </a>
        </div>
    </div>
  </div>


      <footer class="post-footer">

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/06/02/Trinity%E5%AE%89%E8%A3%85%E5%A4%87%E5%BF%98/" rel="prev" title="Trinity安装备忘">
      <i class="fa fa-chevron-left"></i> Trinity安装备忘
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/06/15/14-linux%E8%BF%9B%E7%A8%8B%E5%8E%9F%E7%90%86%E3%80%81%E7%B1%BB%E5%9E%8B%E5%92%8C%E5%86%85%E6%A0%B8%E7%8A%B6%E6%80%81/" rel="next" title="14.linux进程原理、类型和内核状态">
      14.linux进程原理、类型和内核状态 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">lcxiao</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">38</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
        <span class="site-state-item-count">1</span>
        <span class="site-state-item-name">分类</span>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">9</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>


  <div class="links-of-blogroll motion-element">
    <div class="links-of-blogroll-title">
      <i class="fa fa-fw fa-link"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="http://163.com/" title="http:&#x2F;&#x2F;163.com" rel="noopener" target="_blank">163</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="http://baidu.com/" title="http:&#x2F;&#x2F;baidu.com" rel="noopener" target="_blank">baidu</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="/dalipan.com" title="dalipan.com">dalipan</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://google.com/" title="https:&#x2F;&#x2F;google.com" rel="noopener" target="_blank">Google</a>
        </li>
    </ul>
  </div>

      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">lcxiao</span>
</div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  















  

  

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
